package com.jaychen.spring.core.io;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

/**
 * 文件的形式读取
 *
 * @Author Jay Chen
 * @Date 2020/11/9 18:56
 */
public class ClassPathXmlResource extends AbstractResource {

    /**
     * 资源定位符
     */
    private URL url;

    public ClassPathXmlResource(URL url) {
        this.url = url;
    }

    /**
     * 返回文件流
     *
     * @return InputStream
     * @throws IOException
     */
    @Override
    public InputStream getInputStream() throws IOException {
        return url.openConnection().getInputStream();
    }
}
